<?php

namespace mpend\modules\help\controllers;

use common\models\help\Feedback;
use Yii;
use mpend\components\Controller;

class FeedbackController extends Controller
{
    protected function rules()
    {
        return [
            [
                'allow' => true,
                'roles' => ['@'],
            ]
        ];
    }

    /**
     * @inheritdoc
     */
    protected function verbs()
    {
        return [
            '*' => ['POST'],
        ];
    }

    /**
     * 提交反馈
     */
    public function actionCreate()
    {
        $model = new Feedback();
        $model->user_id = $this->uid;
        if (!$model->load(Yii::$app->request->post(), '')) {
            parent::error('缺少信息');
        }
        return $model->save();
    }
}